import java.text.NumberFormat;
import java.util.Scanner;
public class PP10_5DVD implements Comparable
{
    private String title, director;
    private int year;
    private double cost;
    private boolean bluray;

    //------------------------------------------------------------------------
    //  Creats a new DVD with the specified information.
    //------------------------------------------------------------------------
    public PP10_5DVD(String title, String director, int year, double cost, boolean bluray)
    {
        this.title = title;
        this.director = director;
        this.year = year;
        this.cost = cost;
        this.bluray = bluray;
    }

    //-------------------------------------------------------------------------
    //  Returns a string description of this DVD.
    //-------------------------------------------------------------------------
    public String toString()
    {
        NumberFormat fmt = NumberFormat.getPercentInstance();
        String description;

        description = fmt.format(cost) + "\t" + year + "\t";
        description += title + "\t" + director;
        if (bluray)
            description += "\t" + "Blu-ray";

        return description;
    }

    public int compareTo(Object other)
    {
        int result;

        String otherTitle = ((PP10_5DVD)other).getTitle();
        result = this.title.compareTo(otherTitle);

        return  result;
    }

    public String getTitle(){
        return this.title;
    }
}




 class Movies
{
    //-----------------------------------------------------------------------
    //  Creates a DVDCollection object and adds some DVDs to it. Prints
    //  reports on the status of the collection.
    //-----------------------------------------------------------------------
    public static void main(String[] args)
    {
        PP10_5DVD[] movies = new PP10_5DVD[7];

        movies[0] = new PP10_5DVD("The Godfather", "Francis Ford Coppla", 1972, 24.95, true);
        movies[1] = new PP10_5DVD("District 9", "Neill Blomkamp", 2009, 19.95, false);
        movies[2] = new PP10_5DVD("Iron Man", "Jon Favreau", 2008, 15.95, false);
        movies[3] = new PP10_5DVD("All About Eve", "Joseph Mankiewicz", 1950, 17.50, false);
        movies[4] = new PP10_5DVD("The Matrix", "Andy & Lana Wachowski", 1999, 19.95, true);
        movies[5] = new PP10_5DVD("Iron Man 2", "Jon Favreau", 2010, 22.99, false);
        movies[6] = new PP10_5DVD("Casablanca", "Michael Curtiz", 1942, 19.95, false);


        Scanner scan = new Scanner(System.in);

        System.out.println("What sequence do you want to see?    Increment: 0 ;decrement:  other Numbers.");
        int a = scan.nextInt();
        if (a==0) {
            Sorting.selectionSort(movies);
            for (PP10_5DVD movie : movies)
                System.out.println(movie);
        }
        else {
            PP10_4Sorting.selectionSort(movies);
            for (PP10_5DVD movie : movies)
                System.out.println(movie);
        }
    }
}
